Skip to content

chore(phpstan): require comments on inline @phpstan-ignore annotations#482

Merged
turegjorup merged 1 commit into
release/3.0.0from
feature/phpstan-commented-ignores
Jun 5, 2026
Merged

chore(phpstan): require comments on inline @phpstan-ignore annotations#482
turegjorup merged 1 commit into
release/3.0.0from
feature/phpstan-commented-ignores

Conversation

@turegjorup

Copy link
Copy Markdown
Contributor

Summary

Enables PHPStan's reportIgnoresWithoutComments parameter so every inline @phpstan-ignore annotation must carry a (comment) explaining the suppression. Adopts the convention already in place in itk-dev/openid-connect-bundle.

Features Added

  • Inline PHPStan suppressions now fail analysis unless written as // @phpstan-ignore identifier (reason).
  • Zero-cost adoption: no inline @phpstan-ignore annotations exist in src/ or migrations/ today, so this purely enforces discipline on future suppressions. The generated phpstan-baseline.neon is unaffected.

Files Changed

  • phpstan.dist.neon - added reportIgnoresWithoutComments: true with explanatory comment
  • CHANGELOG.md - entry under [Unreleased]

Test Plan

  • task code-analysis[OK] No errors (verified locally)
  • To see the gate in action: add a bare // @phpstan-ignore something to any file under src/ and observe PHPStan fail with a missing-comment error

🤖 Generated with Claude Code

Enable reportIgnoresWithoutComments so every inline suppression documents
why it is safe to ignore. No existing inline ignores in src/ or
migrations/, so the analysis stays green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@turegjorup turegjorup self-assigned this Jun 5, 2026
@turegjorup
turegjorup merged commit 634925a into release/3.0.0 Jun 5, 2026
20 checks passed
@turegjorup
turegjorup deleted the feature/phpstan-commented-ignores branch June 5, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant